#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

const int MAXN = 1e6+10;

char s[MAXN];
int cnt[MAXN],sa[MAXN],id[MAXN],ork[MAXN<<1],rk[MAXN<<1],px[MAXN],n,m = 300;

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	scanf("%s",s+1); n = strlen(s+1);
	for(int i = 1;i <= n;i++) ++cnt[rk[i] = s[i]];
	for(int i = 1;i <= m;i++) cnt[i] += cnt[i-1];
	for(int i = n;i >= 1;i--) sa[cnt[rk[i]]--] = i;
	for(int h = 1,p;h < n;h <<= 1,m = p){
		p = 0; for(int i = n;i > n-h;i--) id[++p] = i;
		for(int i = 1;i <= n;i++) if(sa[i] > h) id[++p] = sa[i] - h;
		for(int i = 1;i <= m;i++) cnt[i] = 0;
		for(int i = 1;i <= n;i++) ++cnt[px[i] = rk[id[i]]];
		for(int i = 1;i <= m;i++) cnt[i] += cnt[i-1];
		for(int i = n;i >= 1;i--) sa[cnt[px[i]]--] = id[i];
		for(int i = 1;i <= n;i++) ork[i] = rk[i];
		p = 0;
		for(int i = 1;i <= n;i++)
			rk[sa[i]] = (ork[sa[i]] == ork[sa[i-1]] && ork[sa[i]+h] == ork[sa[i-1]+h]) ? p : ++p;
	}
	for(int i = 1;i <= n;i++) printf("%d%c",sa[i]," \n"[i==n]);
	return 0;
}

